import store from '@/store'
import { listTotree } from '@/utils/index'
// 此文件用于配置项和相关参数设置

//详情展示页
//基本信息 
//基础信息模块
const detailInfo = [{
        label: "计划名称",
        name: "planName",
        value: "1"
    }, {
        label: "计划周期类别",
        name: "planPeriodType",
        value: "1"
    }, {
        label: "最新任务时间",
        name: "deviceNumber",
        value: "1"
    }, {
        label: "计划开始时间",
        name: "dailyStartTime",
        value: "1"
    }, {
        label: "计划周期",
        name: "dailyPeriod",
        value: "1"
    }, {
        label: "跳过周期",
        name: "dailySkipDays",
        value: "1"
    }, {
        label: "计划时间",
        name: "regularStartTime",
        value: "1"
    }, {
        label: "创建人",
        name: "productDate",
        value: "1"
    }, {
        label: "创建时间",
        name: "factoryNumber",
        value: "1"
    }, {
        label: "最后更新",
        name: "model",
        value: "1"
    }

]

const detailShowInfo = { title: "基础信息", content: detailInfo }
const checkDeviceShowInfo = {
    title: "检定设备",
    content: "",
    showPage: false,
    tableColumns: [
        { type: "index", label: "序号", width: 140 },
        { prop: "assetName", label: "设备名称", minWidth: 180 },

        {
            prop: "assetNumber",
            label: "设备编号",
            width: 100,
            // render: (row) => {
            //   const { deviceInfo } = row;
            //   return deviceInfo.name ? deviceInfo.name :"";
            // },
        },
        {
            prop: "useOrganName",
            label: "使用部门",
            width: 100,
        },
        { prop: "partPicList", label: "检定部位简图", minWidth: 180 },
    ],
    tableData: []
}
const checkOperateShowInfo = {
    title: "检定员",
    content: "",
    showPage: false,
    tableColumns: [
        { type: "index", label: "序号", width: 140 },
        { prop: "empno", label: "员工编号", minWidth: 180 },

        {
            prop: "userName",
            label: "姓名",
            width: 100,
            // render: (row) => {
            //   const { deviceInfo } = row;
            //   return deviceInfo.name ? deviceInfo.name :"";
            // },
        },
        {
            prop: "deviceNumber",
            label: "手机号",
            width: 100,
        },
        { prop: "organName", label: "部门", minWidth: 180 }
    ],
    tableData: []
}
const checkItemsShowInfo = {
        title: "检定项",
        showPage: false,
        content: "",
        tableColumns: [
            { type: "index", label: "序号", width: 140 },
            { prop: "part", label: "检定部位", minWidth: 180 },

            {
                prop: "content",
                label: "检定内容",
                width: 100,
                // render: (row) => {
                //   const { deviceInfo } = row;
                //   return deviceInfo.name ? deviceInfo.name :"";
                // },
            },
            {
                prop: "standard",
                label: "检定基准",
                width: 100,
            },
            { prop: "method", label: "检定方法", minWidth: 180 },
            { prop: "upPicFlag", label: "上传图片", minWidth: 180 },
            { prop: "upVideoFlag", label: "上传视频", minWidth: 180 },
        ],
        tableData: []
    }
    // 基础信息表单配置
const formData = {
        title: '基础信息',
        formModel: {
            deviceId: "",
            planName: "",
            planPeriodType: "",
            dailyStartTime: "",
            description: "",
            dailySkipDays: [],
            planPeriodTotalValue: "",
            dailyPeriodType: "", //这个字段单独处理
        },
        formComponent: [{
                type: 'input',
                label: '计划名称',
                model: 'planName',
                keyUpEnter: 'handleFilter',
                rules: [{ required: true, message: '请输入计划名称', trigger: 'blur' }]
            },
            // {
            //     span: 18,
            //     type: 'select',
            //     label: '计划周期类别',
            //     model: 'planPeriodType',
            //     option: [{ label: "定期", value: "1" }, { label: "日常", value: "0" }],
            //     rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]

            // },
            {
                span: 5,
                type: 'datePicker',
                label: '计划开始时间',
                model: 'dailyStartTime',
                option: [1, 2, 3],
                rules: [{ required: true, message: '请输入计划开始时间', trigger: 'blur' }]
            },
            {
                span: 24,
                type: 'input',
                label: '计划描述',
                model: 'description',
                option: [1, 2, 3],
                rules: [{ required: true, message: '请输入计划开始时间', trigger: 'blur' }]
            },
            // {
            //     span: 8,
            //     type: 'selectRadio',
            //     label: '周期',
            //     model: "dailyPeriod",
            //     defaultValue: "day",
            //     unit: "dailyPeriodType",
            //     option: [{ label: "天", value: "0" }, { label: "周", value: "1" }, { label: "月", value: "2" }],
            //     rules: [{ required: true, message: '请输入计划周期', trigger: 'blur' }]
            // },
            // {
            //     span: 11,
            //     type: 'selectCheck',
            //     label: '跳过日期',
            //     model: "dailySkipDays",
            //     option: [{ value: 1, label: "周一" }, { value: "2", label: "周二" }, { value: "3", label: "周三" }, { value: "4", label: "周四" }, { value: "5", label: "周五" }],
            //     rules: [{ required: true, message: '请输入计划周期', trigger: 'blur' }]
            // }

        ],
        formComponent1: [


            {
                type: 'input',
                label: '计划名称',
                model: 'planName',
                keyUpEnter: 'handleFilter',
                rules: [{ required: true, message: '请输入计划名称', trigger: 'blur' }]
            },
            {
                span: 18,
                type: 'select',
                label: '计划周期类别',
                model: 'planPeriodType',
                option: [{ label: "定期", value: "1" }, { label: "日常", value: "0" }],
                rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]

            },
            {
                span: 5,
                type: 'datePicker',
                label: '计划开始时间',
                model: 'regularStartTime',
                option: [1, 2, 3],
                rules: [{ required: true, message: '请输入计划开始时间', trigger: 'blur' }]
            }
        ]
    }
    // 档案信息
const operateFormInfo = {
        title: '检定员',
        formModel: {
            membId: ""
        },
        formComponent: [
            //     {
            //     type: 'select',
            //     label: '检定员类别',
            //     model: 'membType',
            //     option: [{ label: "指定人员", value: "0" }, { label: "指定部门", value: "1" }],
            //     rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
            // },
            {
                type: 'select',
                label: '选择检定员',
                model: 'membId',
                option: store.state.app.allUser,
                rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
            }
        ],
        formComponent1: [{
            type: 'select',
            label: '检定员类别',
            model: 'membType',
            option: [{ label: "指定人员", value: "0" }, { label: "指定部门", value: "1" }],
            rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
        }, {
            type: 'cascader',
            label: '选择指定部门',
            model: 'membExt',
            option: listTotree(store.state.app.allCode.department),
            rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
        }]
    }
    //整理后的表单配置
const deviceForm0 = [{
    formName: "计划基础信息",
    formRef: 'table1', //表单ref
    formModel: formData.formModel, //表单model
    formComponent: formData.formComponent,
    formName: formData.title //表单标题
}]
const deviceForm1 = [{
    formName: "计划基础信息",
    formRef: 'table1', //表单ref
    formModel: formData.formModel, //表单model
    formComponent: formData.formComponent1,
    formName: formData.title //表单标题
}]
const operateForm0 = [{
    formName: "检定员",
    formRef: 'table2', //表单ref
    formModel: operateFormInfo.formModel, //表单model
    formComponent: operateFormInfo.formComponent,
    formName: operateFormInfo.title //表单标题 
}]

const operateForm1 = [{
    formName: "检定员",
    formRef: 'table2', //表单ref
    formModel: operateFormInfo.formModel, //表单model
    formComponent: operateFormInfo.formComponent1,
    formName: operateFormInfo.title //表单标题 
}]

const data = {

    basicForm0: deviceForm0,
    basicForm1: deviceForm1,
    operateForm0: operateForm0,
    operateForm1: operateForm1,
    //----------表单显示相关---------//
    //计划基本信息
    detailShowInfo: detailShowInfo,
    //检定设备
    checkDeviceShowInfo: checkDeviceShowInfo,
    //检定员
    checkOperateShowInfo: checkOperateShowInfo,
    //检定项
    checkItemsShowInfo: checkItemsShowInfo
}
export default data